import xss from 'xss';

interface PropsType {
  msgContent: {
    text: string;
  }
}

export default function(props: PropsType) {
  const { text = '' } = props.msgContent;
  // replaceAll在部分安卓机型自带浏览器下出现兼容性问题
  const html = text.replace(/@.+\s/g, str => `<a>${str}</a>`);
  return <div className="userMessage" dangerouslySetInnerHTML={{ __html: xss(html) }} />
}